﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace collabr8
{
    public partial class MonitorForm : Form
    {
        Bitmap currentPicture = null;
        ServerForm father;

        public MonitorForm()
        {
            InitializeComponent();
        }

        public MonitorForm(ServerForm father, int width, int height)
        {
            InitializeComponent();
            this.father = father;
            this.Location = father.Location;
            this.Top += 423;
            this.Width = width;
            this.Height = height;
        }

        public Bitmap Picture
        {
            set
            {
                if (this.currentPicture != null)
                    this.currentPicture.Dispose();
                this.currentPicture = new Bitmap(value);
                this.Width = value.Width;
                this.Height = value.Height;
                this.Refresh();
            }
        }
       
        private void MonitorForm_Paint(object sender, PaintEventArgs e)
        {
            if (this.currentPicture != null)
            {
                e.Graphics.DrawImage(this.currentPicture, new Point(0, 0));
            }            
        }

        private void MonitorForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.Hide();
            e.Cancel = true; 
        }
    }
}
